package springboot.springMVC.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/calc")
public class CalcController {
 @RequestMapping("/sum")
    public String sum(Integer n1,Integer n2) {
        if(n1==null || n2==null) {
            return "参数不合法，请检查后再提交";
        }
        Integer sum=n1+n2;
        return "<h1>计算结果"+sum+"<h1>";
    }
@RequestMapping("/cheng")
    public String cheng(Integer n1,Integer n2) {
        if(n1==null || n2==null) {
            return "参数不合法，请检查后再提交";
        }
        Integer sum=n1*n2;
        return "<h1>计算结果"+sum+"<h1>";
    }
}
